<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="nav" content="1" />
<meta name="acc" content="1-0" />
<title>工作任务</title>
<!--  通用情况下 不引入 js css  表单验证  js 放置到页面中     -->
<%@ include file="/common/extjs.jsp"%>
<script>
$(document).ready(function() {
	$("#warnDate").addClass("Wate").bind("click", function(){
	 WdatePicker({skin:'whyGreen',minDate:'1900-10-01' , dateFmt:'yyyy-MM-dd HH:mm:ss'});});
	$("#planStarDate").addClass("Wate").bind("click", function(){
	 WdatePicker({skin:'whyGreen',minDate:'1900-10-01' , dateFmt:'yyyy-MM-dd HH:mm:ss'});});
	$("#planEndDate").addClass("Wate").bind("click", function(){
	 WdatePicker({skin:'whyGreen',minDate:'#F{$dp.$D(\'planStarDate\')}' , dateFmt:'yyyy-MM-dd HH:mm:ss'});
	 });

	 $("#executor").click(function(){
		  UserSelector.getView(function(a,c) {
			 	 $("#executor").val(c);
					},true
				).show();
	 });
	 
	 //为第一个文本框获得焦点
	  $("#title").focus();
	 //验证
	 $("#inputForm").validate({
		 rules:{
			 title:{
				 required:true
			 },
			 usernames:{
				 required:true
			 },
			 warnDate:{
				 required:true
			 },
			 planStarDate:{
				 required:true
			 },
			 planEndDate:{
				 required:true,
			 }
		 },
		 messages:{
			 title:{
				 required:"必须填写任务标题！"
			 },
			 usernames:{
				 required:"请填写执行人！"
			 },
			 warnDate:{
				 required:"请输入提醒时间!"
			 },
			 planStarDate:{
				 required:"请输入计划开始时间!"
			 },
			 planEndDate:{
				 required:"请输入计划结束时间!",
			 }
		 }
	 });
});	
</script>
</head>
<body>
<form action="${ctx}/app/worktask!save.action" method="post" id="inputForm"
	class='yform' enctype="multipart/form-data">
<div id="caption" ><h6>发布任务</h6></div>
<table class="noborder">

	<tr class="type-text">
		<td>标题</td>
		<td><input name="id" type="hidden" value="${id}" /> <input
			id="title" name="title" type="text" value="${title}" /></td>
		<td>执行人</td>
		<td>
			<input id="executor" name="usernames" type="text" value="${executor}" class="choose" readonly="readonly"/>
		</td>
	</tr>
	<tr>
		<td>内容</td>
		<td colspan="3"><textarea name="content" cols="" rows="3">${content}</textarea> </td>
	</tr>
	<tr class="type-text">
		<td>计划开始日期</td>
		<td><input type="text" id="planStarDate" name="planStarDate"  value="${planStarDate}" class="required"/></td>
		<td>计划结束日期</td>
		<td><input type="text" id="planEndDate" name="planEndDate"  value="${planEndDate}" class="required"/></td>
	</tr>
	<tr class="type-text">
		<td>提醒时间</td>
		<td><input type="text" id="warnDate" name="warnDate"  value="${warnDate}" class="required"/></td>
		<td>提醒类型</td>
		<td><pt:code category="1005" name="warnType" default="${warnType}"/></td>
	</tr>
	<tr>
		<td>附件</td>
		<td colspan="3"><input type="file" name="attachmention.upfile" size="40"/> </td>
	</tr>
	<c:if test="${not empty attachment.id}">
				<tr id="attachment">
				<td>已有附件</td>
				<td colspan="3">
				<a title="下载"
					href="${ctx}/servlet/annex?id=${attachment.id}">${attachment.upfileFileName}</a>
				<a href="javascript:deleteAttachment('${attachment.id}')" class="delete">删除</a>
				</td>
			</tr>
			</c:if>
	<tr>
		<td>备注</td>
		<td colspan="3"><textarea name="remark" rows="3">${remark}</textarea> </td>
	</tr>
</table>
<div class="type-button"><input type="submit"
	class="submit" value="提交" />&nbsp; <input  type="button"
	value="返回" class="reset" onclick="history.back()" /></div>
</form>
</body>
</html>
